

#pragma once

#include "wrapper.h"

namespace tools
{
    template<size_t N>struct Wrapper<ONLY_REGISTRED_TYPES, N>: Wrapper<void, N>
    {
        typedef Wrapper<void, N> Parent;

        Wrapper(): wrapper_details::WrapperOperator<ONLY_REGISTRED_TYPES, N>() {}

        Wrapper(const Wrapper& src);
        template<class U> Wrapper(const U& src);
        template<class U, size_t I> Wrapper(const Wrapper<U, I>& src);

        Wrapper& operator=(const Wrapper& src);
        template<class U> Wrapper& operator=(const U& src);
        template<class U, size_t I> Wrapper& operator=(const Wrapper<U,I>& src);
    };

//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------

#define dWRAPPER Wrapper<ONLY_REGISTRED_TYPES, N>
//---------------------------------------------------------------------------------------------
    template<size_t N>
        dWRAPPER::Wrapper(const Wrapper& src) 
        {
            operator=(src); 
        }
//---------------------------------------------------------------------------------------------    
    template<size_t N>
        template<class U> dWRAPPER::Wrapper(const U& src)  
        {
            operator=(src); 
        }
//---------------------------------------------------------------------------------------------
    template<size_t N>
        template<class U, size_t I> dWRAPPER::Wrapper(const Wrapper<U, I>& src)
        { 
            operator=(src); 
        }
//---------------------------------------------------------------------------------------------
    template<size_t N>
        dWRAPPER& dWRAPPER::operator=(const Wrapper& src)
        {
            Clear();
            return src.Clone(*this), *this; 
        }
//---------------------------------------------------------------------------------------------
    template<size_t N>
        template<class U> dWRAPPER& dWRAPPER::operator=(const U& src)
        {
            enum { eVALID = wrapper_details::Type2Enum<U>::eTYPE!=wrapper_details::eNOT_REGISTRED };
            static_assert(eVALID, "THIS_TYPE_NOT_SUPPORT");
            return Parent::operator=(src), *this;
        }
//---------------------------------------------------------------------------------------------
    template<size_t N>
        template<class U, size_t I> dWRAPPER& dWRAPPER::operator=(const Wrapper<U,I>& src)
        {
            enum { eVALID = wrapper_details::Type2Enum<U>::eTYPE!=wrapper_details::eNOT_REGISTRED };
            static_assert(eVALID, "THIS_TYPE_NOT_SUPPORT");
            return Parent::operator=(src), *this;
        }
//---------------------------------------------------------------------------------------------

#undef dWRAPPER

}//namespace tools

